//样条曲线转换为三次Bezier曲线

void spline_to_bezier(const Point &p0, const Point &p1, const Point &p2, const Point &p3,
		Point &c0, Point &c1, Point &c2, Point &c3)
	{
		const float tension = 0.5f/3.0f;
		c0 = p1;

		float d1 = sqrt((p2.X - p0.X)*(p2.X - p0.X) + (p2.Y - p0.Y)*(p2.Y - p0.Y));
		float d2 = sqrt((p1.X - p3.X)*(p1.X - p3.X) + (p1.Y - p3.Y)*(p1.Y - p3.Y));
		float mn = min(d1, d2);

		c1.X = (p2.X - p0.X)*tension*mn / d1 + p1.X;
		c1.Y = (p2.Y - p0.Y)*tension*mn / d1 + p1.Y;

		c2.X = (p1.X - p3.X)*tension*mn / d2 + p2.X;
		c2.Y = (p1.Y - p3.Y)*tension*mn / d2 + p2.Y;

		/*c1.X = (p2.X - p0.X) * (tension / 3.0f) + p1.X;
		c1.Y = (p2.Y - p0.Y) * (tension / 3.0f) + p1.Y;

		c2.X = (p1.X - p3.X) * (tension / 3.0f) + p2.X;
		c2.Y = (p1.Y - p3.Y) * (tension / 3.0f) + p2.Y;*/

		c3 = p2;

	}